#define  _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    vector<int> missingTwo(vector<int>& nums) {
        int dif = 0;
        for (auto e : nums)dif ^= e;
        for (int i = 1; i <= nums.size() + 2; i++)dif ^= i;
        int dif_bit = dif & (-dif), n1 = 0, n2 = 0;
        for (auto e : nums)
            if (e & dif_bit) n1 ^= e;
            else n2 ^= e;
        for (int i = 1; i <= nums.size() + 2; i++)
            if (i & dif_bit) n1 ^= i;
            else n2 ^= i;
        return { n1, n2 };
    }
};